<template>
  <div class="main">
    <h1>
      专题精选
      <i-icon type="enterinto" size="20" color="#80848f"/>
    </h1>
    <div class="box">
      <scroll-view class="scroll-view" :scroll-x="true">
        <div class="item" :key="index" v-for="(item, index) in topicList" @click="topicDetail(item.id)">
          <img :src="item.item_pic_url">
          <div class="btom">
            <div>
              <h2>{{item.title}}</h2>
              <p>{{item.subtitle}}</p>
            </div>
            <div>
              {{item.price_info}}元起
            </div>
          </div>
        </div>
      </scroll-view>
    </div>
  </div>
</template>

<script>
export default {
  props: ['topicList'],
  methods: {
    topicDetail (id) {
      wx.navigateTo({
        url: `/pages/topicDetail/main?id=${id}`
      })
    }
  }
}
</script>

<style lang="less" scoped>
.main{
  background: #fff;
  h1{
    font-size: 16px;
    text-align: center;
    height: 50px;
    line-height: 47px;
  }
  .box {
    .scroll-view {
      white-space: nowrap;
      .item {
        display: inline-block;
        width: 575rpx;
        margin-left: 25rpx;
        img {
          display: block;
          width: 575rpx;
          height: 325rpx;
          border-radius: 10rpx;
        }
        .btom {
          display: flex;
          justify-content: space-between;
          margin-bottom: 42rpx;
          width: 100%;
          div:nth-child(1) {
            width: 90%;
            h2 {
              height: 50rpx;
              font-size: 30rpx;
              font-weight: bold;
              margin-top: 8rpx;
              line-height: 50rpx;
            }
            p {
              width: 90%;
              color: #8a8a8a;
              font-size: 24rpx;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              margin-top: 8rpx;
            }
          }
          div:nth-child(2) {
            margin-top: 8rpx;
            color: #9c3232;
            font-size: 24rpx;
            height: 50rpx;
            line-height: 50rpx;
          }
        }
      }
      .item:last-child {
        margin-right: 25rpx;
      }
    }
  }
}
</style>
